palPalEntry(255) As PALETTEENTRY ' Enough for 256 colors
End Type
Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors(255) As PALETTEENTRY 'Enough for 256 colors
End Type
Type RECT
Left As Integer
Top As Integer
Right As Integer
Bottom As Integer
End Type
Global Const PIXELS = 3
Global Const SRCCOPY = &HCC0020
Global Const BI_RGB = 0
Global Const DIB_RGB_COLORS = 0
Global Const GMEM_MOVEABLE = 2
Global Const RASTERCAPS = 38
Global Const RC_STRETCHDIB = &H2000
Global Const RC_PALETTE = &H100
Global Const PLANES = 14
Global Const BITSPIXEL = 12
Global Const SIZEPALETTE = 104
Global Const PD_PRINTSETUP = &H40&
'The following declares must each be entered on a single line:
Declare Function CreateCompatibleDC Lib "GDI" (ByVal hDC As Integer) As Integer
Declare Function CreateCompatibleBitmap Lib "GDI" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC As Integer, ByVal iCapabilitiy As Integer) As Integer
Declare Function GetSystemPaletteEntries Lib "GDI" (ByVal hDC As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
Declare Function CreatePalette Lib "GDI" (lpLogPalette As LOGPALETTE) As Integer
Declare Function SelectObject Lib "GDI" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
Declare Function BitBlt Lib "GDI" (ByVal hDCDest As Integer, ByVal XDest As Integer, ByVal YDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hDCSrc As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwROP As Long) As Integer
Declare Function GetDIBits Lib "GDI" (ByVal hDC As Integer, ByVal hBitmap As Integer, ByVal nStartScan As Integer, ByVal nNumScans As Integer, ByVal lpBits As Long, BITMAPINFO As BITMAPINFO, ByVal wUsage As Integer) As Integer
Declare Function StretchDIBits Lib "GDI" (ByVal hDC As Integer, ByVal DestX As Integer, ByVal DestY As Integer, ByVal wDestWidth As Integer, ByVal wDestHeight As Integer, ByVal SrcX As Integer, ByVal SrcY As Integer, ByVal wSrcWidth As Integer, ByVal wSrcHeight As Integer, ByVal lpBits As Long, BitsInfo As BITMAPINFO, ByVal wUsage As Integer, ByVal dwROP As Long) As Integer
Declare Function DeleteObject Lib "GDI" (ByVal hObject As Integer) As Integer
Declare Function DeleteDC Lib "GDI" (ByVal hDC As Integer) As Integer
Declare Function GlobalAlloc Lib "KERNEL" (ByVal wFlags As Integer, ByVal lMem As Long) As Integer
Declare Function GlobalLock Lib "KERNEL" (ByVal hMem As Integer) As Long
Declare Function GlobalUnlock Lib "KERNEL" (ByVal hMem As Integer) As Integer
Declare Function GlobalFree Lib "KERNEL" (ByVal hMem As Integer) As Integer
Declare Function SelectPalette Lib "USER" (ByVal hDC As Integer, ByVal hPalette As Integer, ByVal bForceBackground As Integer) As Integer
Declare Function RealizePalette Lib "USER" (ByVal hDC As Integer) As Integer
Declare Function GetWindowDC Lib "USER" (ByVal hWnd As Integer) As Integer
Declare Function GetWindowRect Lib "USER" (ByVal hWnd As Integer, lpRect As RECT) As Integer
Declare Function ReleaseDC Lib "USER" (ByVal hWnd As Integer, ByVal hDC As Integer) As Integer
' Error Constants:
' Device does not support StretchDIBits.
Global Const ERR_DEVSTRETCHDIB = 11105
' Palette is not 256-color palette.
Global Const ERR_PALSIZE = 11106
' Unable to create device context.
Global Const ERR_CREATEMEMDC = 11107
' Unable to create bitmap.
Global Const ERR_CREATEBMP = 11108
' Unable to retrieve system palette.
Global Const ERR_GETPALETTE = 11109
' Unable to create a new palette.
Global Const ERR_CREATEPAL = 11120
' Unable to copy bitmap to memory.
Global Const ERR_BITBLT = 11110
' Unable to allocate memory for DIB bits.
Global Const ERR_BITMEM = 11111
' Unable to lock DIB bits memory.
Global Const ERR_LOCKBITMEM = 11112
' Unable to get DIB bits.
Global Const ERR_GETDIB = 11113
' Unable to copy bitmap to destination.
Global Const ERR_STRETCHDIB = 11114
' Unable to unlock DIB bits memory.
Global Const ERR_UNLOCKMEM = 11115
' Unable to free DIB bits memory.
Global Const ERR_FREEMEM = 11116
' Unable to select palette.
Global Const ERR_SELPAL = 11117
' Unable to delete palette.
Global Const ERR_DELPAL = 11121
' Unable to delete bitmap.
Global Const ERR_DELBMP = 11118
' Unable to select palette.
Global Const ERR_DELMEMDC = 11119
Sub pause (interval As Single) 'Interval = length of pause in seconds